package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {



    @ExceptionHandler(value = RuntimeException.class)
    public Result error(Exception e) {
        e.printStackTrace();
        return Result.fail();
    }

    public Result roomExitError(LeaseException exception){
        exception.printStackTrace();
        return Result.build(null,exception.getResultCodeEnum());
    }
}
